'use strict'

import Http from '../kit/HttpKit'
import Api from './Api'

const URL_LIST = Api.API_URL + '/project/list'
const URL_DETAIL = Api.API_URL + '/project/detail'
const URL_DELETE = Api.API_URL + '/project/delete'
const URL_END = Api.API_URL + '/project/end'
const URL_CHECK_STATUS_PASS = Api.API_URL + '/project/checkStatusPass'
const URL_CHECK_STATUS_FAIL = Api.API_URL + '/project/checkStatusFail'

/**
 * 项目列表
 **/
const list = (data, callback)=>{
    data.api_token = Api.getApiToken();
    data.api_user_id = Api.getApiUserId();
    Http.post(URL_LIST, data, json=>{
        Api.getDataCB(json, callback);
    });
}

/**
 * 项目详情
 **/
const detail = (projectId, callback)=>{
    let data = {id: projectId};
    data.api_token = Api.getApiToken();
    data.api_user_id = Api.getApiUserId();

    Http.post(URL_DETAIL, data, json=>{
        Api.getDataCB(json, callback);
    });
}

export default{
    list, detail,
    URL_LIST,URL_DELETE,URL_END, URL_CHECK_STATUS_PASS, URL_CHECK_STATUS_FAIL
}
